<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>订单列表</title>
<link href="${base}/resource/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resource/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resource/admin/js/list.js"></script>
<script type="text/javascript" src="${base}/resource/admin/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${base}/resource/admin/layer/layer.js"></script>
<script type="text/javascript">
$().ready(function() {
	[@flash_message /]

    /** 出单（类似发货）*/
    $(".shipped").click(function(){
        var url=$(this).attr("href");
        layer.open({
            type: 2,
            area: ['650px', '600px'],
            fix: false, //不固定
            maxmin: true,
            content: url
        });
        return false;
    });

    /** 出单结果（类似确认收货）*/
    $(".shipped-result").click(function(){
        var url=$(this).attr("href");
        layer.open({
            type: 2,
            area: ['600px', '500px'],
            fix: false, //不固定
            maxmin: true,
            content: url
        });
        return false;
    });

    /** 手动退款 */
    $(".shipped-refunded").click(function(){
        var url=$(this).attr("href");
        layer.confirm('确定手动退款?', {
            btn: ['确定','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            ajaxToDo(url,function(json){
                if(json.type=="success"){
                    layer.msg(json.content, {icon: 1});
                    $("#listForm").reload();
                }else{
                    layer.msg(json.content, {icon: 1});
                }
            })

        });
        return false;
    });

});
</script>
</head>
<body>
    <!-- 地址导航-->
	<div class="path">
		<a href="${base}/admin/common/index.do">首页</a> &raquo;应用列表<span>${page.total}</span>
	</div>
    <!-- 主体-->
	<form id="listForm" action="list.do" method="get">
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>
                        订单号：<input type="text" name="eq_sn" class="text" value="${eq_sn}" />
                    </td>
                    <td>
                        订单状态：
                 [#--   <select name="eq_orderStatus"  class="text">
                        <option value="">所有</option>
                        <option value="unconfirmed" [#if eq_orderStatus=='unconfirmed'] selected="selected" [/#if]>未确认</option>
                        <option value="confirmed" [#if eq_orderStatus=='confirmed'] selected="selected" [/#if]>已确认</option>
                        <option value="completed" [#if eq_orderStatus=='completed'] selected="selected" [/#if]>已完成</option>
                        <option value="cancelled" [#if eq_orderStatus=='cancelled'] selected="selected" [/#if]>已取消</option>
                    </select>--]
                        <select name="eq_orderStatus"  class="text">
                            <option value="">所有</option>
                            <option value="0" [#if eq_orderStatus=='unconfirmed'] selected="selected" [/#if]>未确认</option>
                            <option value="1" [#if eq_orderStatus=='confirmed'] selected="selected" [/#if]>已确认</option>
                            <option value="2" [#if eq_orderStatus=='completed'] selected="selected" [/#if]>已完成</option>
                            <option value="3" [#if eq_orderStatus=='cancelled'] selected="selected" [/#if]>已取消</option>
                        </select>
                    </td>
                    <td>
                        支付状态：
                        <select name="eq_paymentStatus"  class="text">
                            <option value="">所有</option>
                            <option value="unpaid" [#if eq_paymentStatus=='unpaid'] selected="selected" [/#if]>未支付</option>
                            <option value="paid" [#if eq_paymentStatus=='paid'] selected="selected" [/#if]>已支付</option>
                            <option value="refunded" [#if eq_paymentStatus=='refunded'] selected="selected" [/#if]>已退款</option>
                        </select>
                    </td>
                    <td>
                        保单状态：
                        <select name="eq_shippsingStatus"  class="text">
                            <option value="">所有</option>
                            <option value="unshipped" [#if eq_shippsingStatus=='unshipped'] selected="selected" [/#if]>未出单</option>
                            <option value="shipped" [#if eq_shippsingStatus=='shipped'] selected="selected" [/#if]>出单中</option>
                            <option value="returned" [#if eq_shippsingStatus=='returned'] selected="selected" [/#if]>出单失败</option>
                        </select>
                    </td>
                    <td>
                        <button type="submit">检索</button>
                    </td>
                </tr>
                <tr class="advanced">
                    <td>
                        开始时间：<input type="text" id="beginDate" name="gt_datetime_createDate" class="text Wdate" readonly="readonly"  value="[#if gt_datetime_createDate??]${gt_datetime_createDate?string("yyyy-MM-dd HH:mm:ss")}[#else]${beginData?string("yyyy-MM-dd HH:mm:ss")}[/#if]" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate: '#F{$dp.$D(\'endDate\')}' });"/>
                    </td>
                    <td>
                        结束时间：<input type="text" id="endDate" name="lt_datetime_createDate" class="text Wdate"  readonly="readonly"   value="[#if lt_datetime_createDate??]${lt_datetime_createDate?string("yyyy-MM-dd HH:mm:ss")}[#else]${endData?string("yyyy-MM-dd HH:mm:ss")}[/#if]"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate: '#F{$dp.$D(\'beginDate\')}',maxDate: '${currentDate}'});"/>
                    </td>
                    <td>
                        手机号码：<input type="text" name="eq_paymentUser"  class="text"  value="${eq_paymentUser}" />
                    </td>
                    <td>

                    </td>
                </tr>
            </table>
        </div>
		<div class="bar">
			<div class="buttonWrap">
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>刷新
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
					    每页条数<span class="arrow">&nbsp;</span>
					</a>
                    <div class="popupMenu">
                        <ul id="pageSizeOption">
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 10] class="current"[/#if] val="10">10</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 20] class="current"[/#if] val="20">20</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 50] class="current"[/#if] val="50">50</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 100] class="current"[/#if] val="100">100</a>
                            </li>
                        </ul>
                    </div>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				<th>
                    <span>订单号</span>
				</th>
                <th>
                    <span>订单金额</span>
                </th>
                <th>
                    <span>用户</span>
                </th>
                <th>
                    <span>创建时间</span>
                </th>
                <th>
                    <span>支付状态</span>
                </th>
                <th>
                    <span>保单状态</span>
                </th>
                <th>
                    <span>订单状态</span>
                </th>
                <th>操作</th>
			</tr>
			[#list page.content as entity]
				<tr>
					<td>
						<input type="checkbox" name="ids" value="${entity.id}" />
					</td>
					<td>
						${entity.sn}
					</td>
                    <td>
                        ${entity.amount}
                    </td>
                    <td>
                       <a href="/member/edit?id=${entity.member.id}">${entity.member.username}</a>
                    </td>
                    <td>
                     ${entity.createDate?string("yyyy-MM-dd HH:mm:ss")}
                    </td>
                    <td>
                       [#if entity.paymentStatus='unpaid'] 未支付
                           [#elseif entity.paymentStatus='partialPayment']部分支付
                           [#elseif entity.paymentStatus='paid']<span style="color: #CC0000">已支付</span>
                           [#elseif entity.paymentStatus='partialRefunds']部分退款
                           [#elseif entity.paymentStatus='refunded']已退款
                       [/#if]
                    </td>
                    <td>
                        [#if entity.shippingStatus='unshipped'] 未出单
                        [#elseif entity.shippingStatus='shipped']出单中
                        [#elseif entity.shippingStatus='returned']出单失败
                        [#elseif entity.shippingStatus='received']出单成功
                        [/#if]
                    </td>
                    <td>
                           [#if entity.orderStatus='unconfirmed'] 未确认
                           [#elseif entity.orderStatus='confirmed']已确认
                           [#elseif entity.orderStatus='completed']已完成
                           [#elseif entity.orderStatus='cancelled']已取消
                           [/#if]
                    </td>
                    <td>
                        <a href="edit?id=${entity.id}">[详情]</a>
                        [#if entity.orderStatus!='completed'||entity.orderStatus!='cancelled']
                            [#if entity.paymentStatus='paid'&&entity.shippingStatus='unshipped']
                                <a href="shipped?id=${entity.id}" class="shipped">[马上出单]</a>
                            [/#if]
                            [#if entity.paymentStatus='paid'&&entity.shippingStatus='shipped']
                                <a href="shipResult?id=${entity.id}" class="shipped-result">[出单结果]</a>
                            [/#if]
                            [#if entity.paymentStatus='paid'&&entity.shippingStatus='returned']
                                <a href="refunded?orderId=${entity.id}" class="shipped-refunded">[手动退款]</a>
                            [/#if]
                        [/#if]
                    </td>
				</tr>
			[/#list]
		</table>
      [@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
            [#include "/common/pagination.ftl"]
      [/@pagination]

	</form>
</body>
</html>